package com.ipzoe.common.controller.pub;

import com.ipzoe.common.bean.entity.Admin;
import com.ipzoe.common.bean.response.Response;
import com.ipzoe.common.service.AdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 后台账户公共方法控制器
 * <p>
 * Created 2018/01/19.
 *
 * @author pfzhang
 */
@Api(description = "后台账户公共方法控制器")
@RestController("pubAdminController")
@RequestMapping("/pub/admin/")
public class AdminController {

    @Autowired
    private AdminService adminService;

    /**
     * 登录
     *
     * @param username 昵称
     * @param password 密码
     * @return 管理员对象
     */
    @ApiOperation("登录")
    @PostMapping("/sign-in")
    public Response<Admin> signIn(@ApiParam("用户名") @RequestParam String username,
                                  @ApiParam("密码") @RequestParam String password) {
        return adminService.signIn(username, password);
    }
}
